<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button onclick="xxx()">测试</button>
<script type="text/javascript">
     function currDateStrMs() {
        let now111111 = new Date();
        let year11122 = now111111.getFullYear(); //得到年份
        let month4324234 = now111111.getMonth();//得到月份
        let date56576575 = now111111.getDate();//得到日期
        let day56456456456 = now111111.getDay();//得到周几
        let hour896787 = now111111.getHours();//得到小时
        let minu4543 = now111111.getMinutes();//得到分钟
        let sec565 = now111111.getSeconds();//得到秒
        let MS0987 = now111111.getMilliseconds();//获取毫秒
        let week7545745;
        month4324234 = month4324234 + 1;
        if (month4324234 < 10) month4324234 = "0" + month4324234;
        if (date56576575 < 10) date56576575 = "0" + date56576575;
        if (hour896787 < 10) hour896787 = "0" + hour896787;
        if (minu4543 < 10) minu4543 = "0" + minu4543;
        if (sec565 < 10) sec565 = "0" + sec565;
        if (MS0987 < 100)MS0987 = "0" + MS0987;
        let arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
        week7545745 = arr_week[day56456456456];
        let time76556443 = year11122 + "-" + month4324234 + "-" + date56576575 +" " + hour896787 + ":" + minu4543 + ":" + sec565+"."+MS0987;
        return time76556443;
    }
    // js加载就执行启动就执行两种方式 js启动就执行，js页面加载执行
     (function xxx(){
        alert(currDateStrMs() )
    })()


</script>
</body>
</html>